package com.tgpms.web.earlierStage.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.tgpms.util.Common;
import com.tgpms.web.earlierStage.service.EarlierProjectInfoService;

/**
 * 定时更新应思项目信息
 * @author newway
 *
 */
@Component
//@Controller
public class UpdateUseCodeTask {

	@Autowired
	private EarlierProjectInfoService projectInfoService;
	
//	@RequestMapping("/uptask")
	@Scheduled(cron = "0 0 */1 * * *")
	public void task() {
		try {
			String hour = Common.fromDateFormat("HH");
			if(Integer.parseInt(hour)<=1 || Integer.parseInt(hour)>=23) {
				projectInfoService.updateUseCode();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
